#!/bin/sh
#
# Copyright (C) 2019 Dream Property GmbH, Germany
#                    https://dreambox.de/
#
### BEGIN INIT INFO
# Provides:          fbscaled
# Required-Start:    $local_fs udev recovery_ui tpmd
# Required-Stop:     $local_fs udev recovery_ui tpmd
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start fbscaled at boot time
# Description:       Enable service provided by fbscaled.
### END INIT INFO

test -x @sbindir@/fbscaled || exit 0

case "$1" in
  start)
    echo -n "Starting fbscaled"
    start-stop-daemon -q -p @runstatedir@/fbscaled.pid -x @sbindir@/fbscaled -S -b -m
    echo "."
    ;;
  stop)
    echo -n "Stopping fbscaled"
    start-stop-daemon -q -p @runstatedir@/fbscaled.pid -x @sbindir@/fbscaled -K
    echo "."
    ;;
  restart|reload|force-reload)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "Usage: $0 {start|stop|restart|reload|force-reload}"
    exit 1
    ;;
esac

exit 0
